import 'package:flutter/material.dart';

// 封装一个iconContainView
class IconContainView extends StatelessWidget {
  //icon样式
  IconData icons;

  //默认背景色为红色
  Color containerColor;

  //默认IconSize大小 32
  double iconSize;

  // IconContainView(this.icons, this.containerColor, this.iconSize);//标准初始化器
  
  //参数可缺省初始化器
  IconContainView(this.icons,{
        Color this.containerColor = Colors.red, //默认初始值为红色
        double this.iconSize = 32.0 //默认初始值为32.0
      });

  @override
  Widget build(BuildContext context) {
    return Container(
        color: this.containerColor,
        width: 100.0,
        height: 100.0,
        child: Center(
            child: Icon(
          this.icons,
          size: this.iconSize,
          color: Colors.white,
        )));
  }
}
